package edu.tju.car;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisCarDao implements ICarDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();

	public void deleteCar(long id) throws SQLException {
		sqlMap.delete("deleteCar", id);
	}
	@SuppressWarnings("unchecked")
	public List<Car> getCarAnd(Car car) throws SQLException {
		 return sqlMap.queryForList("getCarAnd", car);
	}
	public Car getCarById(long id) throws SQLException {
		return (Car) sqlMap.queryForObject("getCarById", id);
	}
	public List<Car> getCarOr(Car car) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}
	public Long insertCar(Car car) throws SQLException {
		return (Long)sqlMap.insert("insertCar", car);
	}
	public int updateCar(Car car) throws SQLException {
		return sqlMap.update("updateCar",car);
	}
}
